<!DOCTYPE HTML>
<!-- Departed !-->
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="Stylesheet" type="text/css" href="css/style.css">
        <link rel="Stylesheet" type="text/css" href="css/tango.css">
        <link rel="Stylesheet" type="text/css" href="css/github-markdown.css">
        <title></title>
        <script src="config.js"></script>
        <script src="ajax.js"></script>
        <script src="util.js"></script>
    </head>

    <body>
        <div id="container">
            <div id="header">
                <div id="post-nav">
                    <a href="/">Home</a>
                </div>
            </div>
            <div class="clearfix"></div>
            <div id="title"></div>
            <div id="content" class="markdown-body">
                <image id="wait" src="wait.gif" class="aligncenter"></image>
            </div>
            <div id="comment">
            </div>
        </div>
        <div id="footer"></div>
    </body>

    <script type="text/javascript">
        setTitle(config.blog_name);
        setFooter();
        var id = parseInt(location.pathname.substring(1));
        // id = 1; // for local test.
        if (id) {
            getJSON(getIssuesUrl(id), function(data) {
                setTitle(config.blog_name + " - " + data.title);
                var title = document.getElementById("title");
                var txt = document.createTextNode(data.title);
                title.appendChild(txt);
                var content = document.getElementById("content");
                renderMarkdown(content, data.body);
                var comment = document.getElementById("comment");
                var href = document.createElement("a");
                href.href = getCommentUrl(id);
                var txt = document.createTextNode("Click here to comments");
                href.appendChild(txt);
                comment.appendChild(href);
            });
        } else {
            location.replace("/");
        }
    </script>

</html>
